package com.atguigu.gulimall.search.controller;

import com.atguigu.gulimall.search.dto.SearchParamDTO;
import com.atguigu.gulimall.search.service.IMallSearchService;
import com.atguigu.gulimall.search.vo.SearchResultVO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author : wenchao.long
 * @date : Created in 2021/7/31 13:38 周六
 * @description :
 */
@Controller
@AllArgsConstructor
public class SearchController {

    private final IMallSearchService mallSearchService;

    @GetMapping("/list.html")
    public String listPage(SearchParamDTO searchParamDTO,
                           Model model) {
        SearchResultVO search = mallSearchService.search(searchParamDTO);
        model.addAttribute(search);
        return "list";
    }
}
